Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Análisis de fecha y hora "2021-04-20T00:09:14.7724640+02:00"

La mejor forma de analizar la time = "2021-04-20T00:09:14.7724640+02:00" para la hora válida. Necesito segundos también, sin embargo, una vez

 var h = DateTime.ParseExact(time.Substring(14,5), "hh:mm", CultureInfo.InvariantCulture);

esto devuelve solo hora y minuto, pero también necesito segundos, sin embargo, hay 09: 14.7724640 + 02: 00 y si probé hh: mm: ss el "." lanza una excepción "Fecha y hora no válida"

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

string time = "2021-04-20T00:09:14.7724640+02:00"; DateTime dateTime = DateTime.Parse(time);

Con esto, tiene la cadena completa en el objeto DateTime y puede hacer lo que quiera con ella (por ejemplo, recortar horas, minutos y segundos).

over 4 years ago · Santiago Trujillo Report

0

Está buscando un período de tiempo, datetime también contiene una parte de fecha.

Si usa el siguiente código, obtendrá un DateTime y un TimeSpan

 var timeString = "2021-04-20T00:09:14.7724640+02:00"; var dateTime = DateTime.Parse(timeString); var time = dateTime.TimeOfDay; Console.WriteLine(time);
over 4 years ago · Santiago Trujillo Report

0

puede usar ToString("dd MMMM, yyyy") y darle el formato que desee

 public static string GetDate(DateTime date) { return date.ToString("dd MMMM, yyyy"); }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!